//
//  Map.h
//  Vector_Math
//
//  Created by John R Peterson on 3/13/12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#ifndef Vector_Math_Map_h
#define Vector_Math_Map_h

#include "LinAlg.h"
#include "Line.h"
#include <stdio.h>

// let the value in the cell from 0 to 1 indicate the probability that the cell is occupied
// let values less than 0 indicate unobserved areas

typedef struct RasterMap_struct {
    Matrix *grid;
    Matrix *Twtom; // the origin of the matrix, 0, 0, is located in its upper left hand corner of the matrix
    // we require a transformation from world coordinates to the coordinates that the map is stored in
    // this transformaiton depends on the size of the map and scaling factor choice
    // this transformation includes the application of the scale factor
    
    float resolution; // indicates how many blocks in the map correspond to 1 unit in real world
} RMap;

RMap* newRMap(float resolution, float sizeW);                                   // create an empty map
void RMap_drawLine(RMap *this, Line *l);                                        // draws a line to the map
void RMap_drawLineP2P(RMap *this, float x1, float y1, float x2, float y2);      // writes without bounds checking
void RMap_drawLineP2PSAFE(RMap *this, float x1, float y1, float x2, float y2);  // writes with bounds checkiing

void swap(float *a, float *b);
int ipart(float x);
float fpart(float x);
float rfpart(float x);

#endif
